@extends('layouts.admin')

@section('content')
    <div class="col-md-offset-3 col-md-6">
        {!! Form::open(['action' => 'ShowController@nameOfShow', 'method' => 'post']) !!}
        {!! Form::label('showName', 'ShowName', ['class' => 'control-label']) !!}
        {!! Form::select('showName', $showList , null , ['class' => 'form-control','id'=>'show_select']) !!}
        <br>
        {!! Form::submit('跳转到选定剧集', ['class' => 'form-control btn-danger']) !!}
        {!! Form::close() !!}
    </div>
<div class="row">
    <div class="col-md-offset-1 col-md-10">
        <h1>Fluffy美剧|美剧名称|汇总</h1>
        <table class="table table-hover">
                <thead>
                <tr>
                    <th>#</th>
                    <th>英文名</th>
                    <th>中文名</th>
                    <th>更新时间</th>
                    <th>创建时间</th>
                    <th><span class="glyphicon glyphicon-edit"></span></th>
                </tr>
            </thead>
                 <tbody>

                @foreach($shows as $show)
                    <tr>
                        <td>{{$show->id}}</td>
                        <td>
                            <a class="btn btn-default btn-sm" role="button" href={{route('show.show',['show'=>$show])}}>
                                {{$show->name_en}}&nbsp &nbsp <span class="badge">{{$show->episodes()->count()}}</span>
                            </a>
                        </td>
                        <td>
                            {{$show->name_zh}}
                        </td>
                        <td>{{$show->updated_at->diffForHumans()}}</td>
                        <td>{{$show->created_at->diffForHumans()}}</td>
                        <td>
                            <a class="btn btn-default btn-sm glyphicon glyphicon-pencil" href={{route('show.edit',$show)}} role="button"></a>


                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>
        {!! $shows->render() !!}
    </div>
</div>

@endsection

@section('scripts')
    <script>
        $('#show_select').select2({
            placeholder:'choose a tag',
        });
    </script>
@endsection